package com.bnlr.lrparking.appui.order.stages;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.TextView;

import com.bnlr.lrparking.R;
import com.bnlr.lrparking.base.BaseActivity;
import com.bnlr.lrparking.event.StallPaySucceeEvent;
import com.bnlr.lrparking.appui.order.OrderDetailActivity;

import org.greenrobot.eventbus.EventBus;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * 支付结果
 *
 * Created by hp on 2017/12/8.
 */

public class ReserveSucceedActivity extends BaseActivity {

    private Unbinder unbinder;
    @BindView(R.id.tv_nav_right)
    TextView tv_nav_right;
    @BindView(R.id.tv_lookover_order)
    TextView tv_lookover_order;

    private String orderno;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_reservesucceed);
        unbinder = ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        orderno = getIntent().getStringExtra("orderno");
        tv_nav_right.setOnClickListener(this);
        tv_lookover_order.setOnClickListener(this);
    }

    @Override
    public void onClick(View v) {
        super.onClick(v);
        switch (v.getId()) {

            case R.id.tv_nav_right://完成——————>到车位详情（用event）
                EventBus.getDefault().post(new StallPaySucceeEvent());
                finish();
                break;
            case R.id.tv_lookover_order://去查看——————>到订单详情
                startActivity(new Intent(ReserveSucceedActivity.this, OrderDetailActivity.class)
                        .putExtra("order_detail_id", orderno));
                EventBus.getDefault().post(new StallPaySucceeEvent());
                finish();
                break;
            default:
                break;
        }
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbinder.unbind();
    }

    @Override
    public void onBackPressed() {

    }
}
